package singleton;

/**
 * 懒汉式(线程安全)
 * 优点：懒加载，线程安全。
 * 缺点：效率低。
 * Created by thiswhyme on 2019/03/15.
 */
public class LazySyncSingleton {

    private static LazySyncSingleton instance;

    private LazySyncSingleton() {

    }

    public static synchronized LazySyncSingleton getInstance() {
        if (null == instance) {
            instance = new LazySyncSingleton();
        }
        return instance;
    }
}
